package com.sun.customer.service;

import com.sun.customer.mapper.LZerp.UserBaseDOMapper;
import com.sun.customer.mapper.local.RoleBaseDOMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.UUID;

/**
 * Created by yingsy on 2021-01-22.
 */
@Service
public class TestServiceImpl {

    @Autowired
    private RoleBaseDOMapper roleBaseDOMapper;

    @Autowired
    private UserBaseDOMapper userBaseDOMapper;

    @Transactional
    public Boolean test(Integer num) throws InterruptedException {
        String s = UUID.randomUUID().toString();
        userBaseDOMapper.test("test"+s);
        System.out.println(s);
//        int i = 0;
//        while (Boolean.TRUE){
//            i = i+1;
//            System.out.println(i);
//            Thread.sleep(1000L);
//            if(i > 35){
//                break;
//            }
//        }
        roleBaseDOMapper.test(s);
        if(1000%num == 0){
            return Boolean.FALSE;
        }
        return Boolean.TRUE;
    }
}
